class ZJHGameData extends base.GameSceneGlobalData  
{
    public operateData: any;
    /**
     * 当前注
     */
    public currentScore: number=0;
    /**
     * 当前总注
     */
    public currentScoreCount: number=0;
    /**
     * 是否看过牌
     */
    public isLooked: boolean;
    /**
     * 轮次
     */
    public roundNum: number = 1;


    /**
     * 最大下注
     */
    public lMaxScore: number= 0;
     /**
     * 最小下注单元/底注
     */
    public lCellScore: number= 0;
     /**
     *当前倍数
     */
    public lCurrentTimes: number= 0;
     /**
     * 开牌限制0可看牌,1表示不可看牌
     */
    public cbOpenCard: number= 0;
    /**
    * 转换前庄家序号
    */
    public wBankerUser: number = 0;

    public seatIDList: Array<number> = [];
    /**
    * 游戏当局唯一ID
    */
    public gameId: string = null;
    /**
     * 状态,加注跟住状态，0跟住,1加注
     */
    public addState: number = 0;
    /**
     * 庄家位置
     */
    public bankerSeat: number = 0;
    public cbCardData:any = null;   // 缓存的玩家手牌数据

    public get playerDataType(): any 
    {
        return ZJHPlayerData;
    }

    private static _instance: ZJHGameData;
    public static getInstance(): ZJHGameData 
    {
        if (!this._instance) {
            this._instance = new ZJHGameData();
        }
        return this._instance;
    }
    /*
    *收到游戏开始时间
    */
    public onGetGameStartTime(data): void 
    {
        console.log(">>> ZJHGameData 收到游戏开始时间:" + data.dwGameStartTime);
        this.gameId = data.dwGameStartTime;
    }
    /**
     * 转换椅子编号为座位编号
     * */
    public getSeatID(chairID: number): number 
    {
        var seatID:number = (chairID + ZJHCardLogic.MAX_PLAYER - AppData.getInstance().userData.chairID) % ZJHCardLogic.MAX_PLAYER;
        console.log(">>> ZJHGameData 转换椅子编号为座位编号:" ,chairID,"->"+seatID);
        return seatID;
    }
    
    public onGameStart(data: any)
    {
        //9,100 数据：{"lMaxScore":320,"lCellScore":10,"lCurrentTimes":1,"lUserMaxScore":18828,"wBankerUser":2,"wCurrentUser":3,"cbOpenCard":1}
        console.log(">>> ZJHGameData onGameStart");
        this.lMaxScore = data.lMaxScore;//最大下注
        this.lCellScore = data.lCellScore;//最小下注单元/前注
        this.wBankerUser = data.wBankerUser;//转换前庄家序号
        this.bankerSeat = this.getSeatID(data.wBankerUser);//设置庄家位置
        this.lCurrentTimes = data.lCurrentTimes;//当前倍数
        this.cbOpenCard = data.cbOpenCard;//开牌限制0可看牌,1表示不可看牌
        this.roundNum = 1;
        this.addState = 0;
    }

    // 设置玩家手牌数据
    public onGetCards(data: any): void
    {
        this.cbCardData = data.cbCardData;
    }
}